package com.woniuxy.rbac.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woniuxy.rbac.entity.Member;
import com.woniuxy.rbac.mapper.MemberDao;
import com.woniuxy.rbac.service.MemberService;
import org.apache.shiro.crypto.hash.SimpleHash;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MemberServiceImpl extends ServiceImpl<MemberDao,Member> implements MemberService {
    @Autowired
    MemberDao memberDao;

    @Override
    public Member login(String account) {

        return memberDao.getByAccount(account);
    }

    @Override
    public int insert(Member member) {
        SimpleHash simpleHash=new SimpleHash("md5",member.getPassword(),member.getAccount(),1024);
        member.setPassword(simpleHash.toHex());
        member.setVcode("1");
        member.setStatus("y");
        return memberDao.insert(member);
    }
}
